The following quote is taken from my Beginning C for Arduino book, 2nd ed., page 295:
The keywords.txt File
The Arduino IDE lets you add keywords for syntax highlighting if you wish to do so. For the Dates library, the keywords.txt file contains the following lines:
Note that the format used in the keywords.txt file is pretty fussy. That is, in the first line, Dates is immediately followed by a Tab space, then KEYWORD1. This change causes the class name Dates to appear in the color reserved for KEYWORD1 keywords in your source code files. Using the entries shown here, the word Dates, for example, takes on the same color as for, which, else, etc. when it appears in the source code window of the Arduino IDE.
The next two lines cause the functions defined in the Dates library to have coloring as defined by KEYWORD2. As before, a Tab space must separate the function name from the KEYWORD2 constant. When you view your source code, the words IsLeapYear and GetEaster take on the same color at any other class methods you may use. The two function names, for example, will now have the same color as print in Serial.print().
For the keywords.txt file to take effect, you need to close and reopen the Arduino IDE.
The Dates library mentioned in the quote is taken from a sample library that the chapter builds as an example. The next paragraph in the book explains the themes.txt file, which allows you to change the colors associated with the KEYWORD? directives. I have trouble seeing certain colors, so I changed the colors to make syntax highlighting more readable for me.