Deflection
From TF2 Wiki
Deflection (or Compression Blast) is an ability exclusive to the flamethrower that allows the Pyro to use a blast of compressed air to send flying rockets, grenades, sticky bombs and flares back at the enemy with a click of the alt fire button, consuming 25 ammo each time. Rockets fired from a Level 3 Sentry can also be deflected. The deflected projectiles can be used to damage the enemy. The deflection ability is especially useful for protecting Sentry guns from attacks by Soldiers and Demomen.
With some exceptions, deflected projectiles are considered to have been fired by the pyro deflecting them for the purposes of friendly fire and kill awards. For example, a red grenade will turn blue when deflected and will hurt any RED-team players near it when it explodes. It can also hurt the Pyro who deflected it, in the same way that a Demoman hurts himself with his own grenades. Deflected projectiles are just as powerful as before they were deflected.
The unlockable flamethrower alternative, the Backburner, lacks this ability.
Exceptions
With Sticky Bombs, the bombs can be thrown or pushed along the floor, but they do not switch ownership. The only change to a deflected sticky bomb (besides being moved) is that if the Demoman who shot it is blown up it counts as a kill for the Pyro rather than a suicide.
Aiming
When a projectile is deflected, it is not simply "bounced" as if from a mirror: The Pyro can actually aim it to a new location. For example, a deflected rocket (or flare) is essentially stopped and "re-fired" from it's current position, aimed directly at a point on the nearest surface under the Pyro's crosshair. A skilled or well-positioned pyro can even make rockets deflect at right-angles to their original path.
The ability to aim projectiles is somewhat less useful with grenades due to their arcing trajectory, and further testing is needed to see if they behave similarly.

