toki pona sometimes feels like writing code, in part because it for the most part follows an (E)BNF grammar, like all computer programming languages do. Colorization is a very common way of making code more readable.
This colorization scheme only colorizes the easiest to identify parts of speech. There are too many possibilities to reliably ID nouns, modifiers and verbs. The code behaves strange when it comes to non toki pona text.