Explanation

A candle is made up of a cylinder of wax, which is a fuel (often a hydrocarbon like petrol), this melts then is drawn up the wick by surface tension, it then evaporates and reacts with oxygen in the air. This reaction produces heat, carbon-dioxide and water.

However the reaction can only occur where the air meets the wax vapour. This cannot happen all the way though the flame, just around the outside. So all flames are hollow.

The heat from the flame melts the candle wax which is then drawn up the wick by surface tension, and then evaporates. The wax vapor reacts with the oxygen in the air producing heat, carbon-dioxide and water. The reaction only takes place where the air and the wax meets.

A metal gauze conducts heat away from the flame, this cools the wax and air below the temperature at which they will react, so the flame stops burning.

This means that the combustion is stopped and whatever was in the flame just passes through the gauze and floats upwards. The two visible things coming through the gauze are unburnt wax vapor which condenses to form tiny white droplets looking like white smoke, and partially burnt wax. When wax burns the hydrogen from the hydrocarbon reacts first leaving tiny particles of carbon. When these move through the gauze they form a very black sooty smoke. Inside the flame they are heated to yellow hot are also the reason that a flame gives out so much light.

If you put the gauze near the bottom of the flame there is still lots of unburnt wax but very little soot has had time to be created, so the smoke looks white.

The grill cools down the reacting gasses in the flame stopping the reaction, so you can see inside that the candle is hollow. Low in the candle very little of the wax has reacted at all so there is lots of white unburnt wax smoke produced.

Near the top of the flame there is no completely unburnt wax left but a lot of partially burnt carbon, so the smoke looks very sooty.

If the gauze is high in the flame, you stop the partially burnt wax finishing burnings and lots of black sooty smoke is produced. A Davy lamp using a gauze to stop the lamp igniting explosive gasses.

How did this save miners lives?

During the nineteenth century there was a huge problem with explosive gasses such as fire damp (methane) building up in coal mines and then getting ignited by the candles the miners were using for light. Sir Humphrey Davy managed to solve this problem by enclosing an oil lamp with a metal gauze, so even if the atmosphere inside the gauze became explosive the flames couldn't move through the gauze making the lamp safe to use. It had the added advantage that the flame would burn differently in different atmospheres, giving the miners warning of problems.