Human-computer interaction describes the creation of programs that use colors effectively. Here we are not discussing how effective the implementation of the HCI colors are, but instead are focusing on the learned pair association and repetition of color training in the psychology of learning programming.
Learned pair association is a way of memorizing information by associating it with another set of information. In the United States and many other countries, when driving, there is an association between red traffic signals and "stop." When people see the color red in a light or at a sign for a distance, they know to stop.
Repetition is the process of repeating the same association with and without exposure time delay until it becomes memorized.
Association with color reinforcements take advantage of the Stroop effect. After sufficient training the brain sees the color green and thinks "comment" or the color purple and thinks "text string":
Such interference was explained by the automation of reading, where the mind automatically determines the semantic meaning of the word (it reads the word "red" and thinks of the color "red"), and then must intentionally check itself and identify instead the color of the word (the ink is a color other than red), a process that is not automatized.
Other research has been done with more alternations of text type. Consistency seems to reinforce learning.