Grep has 3 color modes, Auto, Always, and Off.
Auto strips out the codes when it's connected to a non interactive output, such as a pipe (if you want to see why, try redirecting the output of grep --color=always
into a file and then look at the file.. control codes everywhere)