It's random which pets change color as far as I can tell. Some have experienced only captured secondary pets changing, while others have found both captured primary and secondary pets will switch colors each time they're summoned. There's really no hard/fast rule for color-changers; two of the same pet don't always follow the color-changing pattern.
The most common color-changers are probably pets with the beetle, lizard, cat, and snake model. I've also seen a few of the newer wild pets from Pandaria changing.
One thing to keep in mind is that Blizzard is "fixing" color-changers in a future patch. Whatever color pet you capture, is the color pet you'll summon. That's their goal at least. (Part of me hopes it doesn't work

)