The phenomenon of flames coming out of the exhaust of any vehicle is called a Backfire
Basically when you either run rich or lean in the power stroke of the combustion which is not completely burnt , it is sent through the exhaust which obviously being hot reignites with the outside air on contact creating the Backfire effect.
This can be of two types:
Usually super cars and in this case the Kawasaki H2R which have extreme degrees of free flow exhausts and when the diver lets go of the throttle the ECU sometime leave an extra spark to keep the vehicle in power range while shifting gears. So the when the exhaust valves open not all of the fuel is burnt and is sent out of the exhaust which since being a free flow rapidly ignites with the outside air causing flames to shoot out with a pop sound.
Some sports cars(almost all rally cars) have something called as a ALS or Anti lag system this system , the system purposely ignites the exhaust air laden with fuel to create a secondary exposing causing the turbocharger which works on the exhaust to spool up prematurely thus reducing the turbo lag.
People often try to achieve backfire for thrill seeking and fun proposes.
Now to Answer your question:
Where this flames came from?
If you dig deep into the whole concept of backfire you must know that the backfire happens outside the combustion chamber either in the induction system or the exhaust system. The flames you see are the ones from the exhaust system as explained above.
How dangerous is this flames for the care of the motorbike?
- Backfire in the Induction system
If your Valve timing is not proper ie, if the intake valves open even before the combustion is complete then there are chances that the flames might propagate up the intake and explode there which is destructive to the engine and is seriously harmful. This can destroy intake manifolds.
- Backfire in the Exhaust system
This is the more common form and the causes are the above mainly free flow exhaust and delay in exhaust valve timing.This type of backfire is not harmful to the engine and does not cause a serious issue.