It's to show the years of schooling for each group. So, everyone from the green highlighted years would have been at school with Tom Riddle, gold highlighted would have been with the Trio, and so on. The lavender outline indicates those who would have been in school during the time that Dumbledore was Headmaster, starting with the 7th years in 1956-1957.