When you have combustion, such as in fires, oxygen gets consumed, and other gases (such as carbon dioxide) get produced.
The produced gases are hotter than the environment due to the generated energy, and they expand, as heated gases do.
Since their density is lower than the surrounding atmosphere, the gas tends to rise. This has two effects.
First, while it moves up, it carries energy with it, thus the flame ends up pointing upwards. Second, since the products of combustion move up, they make more oxygen available to make the flame continue to burn.
Gravity makes the air more dense nearer to the ground - so it is ultimately because of gravity that flames burn upwards, backwards as that sound! 
rate.............