It is just there so you can see which is which easier. You can also change those colors or remove them completely.
For background: Green is code for classes, yellow for methods, red for loops and blue for any other code blocks such as "if". White is the rest.
For code itself: variable types (int, bytes, also return type void) and class/extends/... are red, some keywords (this, null, …) are blue, others (instanceof) are yellow. Access modifiers (private, public, …) are purple. Comments are blue or gray and the rest is black.