Coloring is a very neat technique in problems involving boards since it allows us to simplify the problem a great deal. The important part is focusing on an adequate subset of the squares, however doing it with colors is a lot easier.
The kinds of colorings can be very different and there is no general rule for determining which one is going to solve the problem. There are some colorings (such as a chessboard coloring) that are frequently used, but the only way to learn how to use this technique is by solving several problems of this style.
When the problem is related to pieces covering a certain figure, the “good colorings” are those that yield an invariant associated with the pieces. This can be the number of squares of one color they cover, the number of colors they may use, some parity argument, etc. Coloring is basically an illustrative way to describe invariants.