You're describing the dehydration of sugar, which is what happens when sucrose, or common table sugar, is mixed with sulfuric acid.
Here's the balanced chemical equations
In the first stage of the reaction, the sulfuric acid will remove water molecules from the sugar in a highly exothermic reaction, creating elemental carbon.
Then the sulfuric acid will oxidize the carbon to form carbon dioxide and sulfur dioxide fumes
The interesting part is that a few moments after the reaction starts, a black colomn made out of carbon atoms will rise from the beaker. This happens because solid state carbon takes up more room due to its planar, layered structure.
As a warning, this experiment should be done in a fume hood because the sufur dioxide fumes are dangerous.
Here are a couple of videos on this reaction (you can find many, mony more on youtube)