The bacteria in your mouth need food to live and multiply. When you eat sugary foods, or even starches such as rice, the bacteria use them as food, too. The bacteria then produce acids that can dissolve tooth enamel (outer layer of the tooth).
The world is slowly waking up to the fact that, when you give the body what it needs, it can heal things we previously thought were impossible. A fine example of what is often deemed as an incurable health problem is dental cavities, but extensive.