Seeking Efficient Approximation Algorithm for Adaptation of TSP
Since this is your exercise, it sounds like you are only looking for a hint or an approach.  So, here is a hint/approach.

Let $M$ be a DFA (deterministic finite-state automaton) that recognizes all legal sequences of colors, where a sequence is legal if it doesn't contain the same color three times in a row.

Construct a new, bigger graph $G'$, formed by a "product construction" of $G$ and $M$.  The number of vertices in $G'$ will be at most the number of vertices of $G$ times the number of states of $M$, so $G'$ will be bigger but not too much bigger.

Now think about what you can do with this $G'$.  Try translating your original problem into some question about $G'$.