|MadSci Network: Chemistry|
Well you kinda have the right idea already.
When the flame is blue, all the fuel is being burned highly efficiently, to the point there is no carbon monoxide being produced.
When you move the pan, two things happen, one you disturb the ratio of fuel to air, and the fuel burns less efficiently, resulting in some of the elements in the fuel fluorescing instead of being burned, yielding different colors and incomplete combustion.
Also, when the pan scrapes along the grill it is on, particles are aerosoled off the surfaces, also yielding fluorescence of those elements.
If you just move the pot over the flame w/o touching the grill, the effect almost nonexistent.
Try the links in the MadSci Library for more information on Chemistry.