Why I Think Spike Eats Gems. · 4:44pm Jun 12th, 2014
They're used to build up his scales. Gems are primarily metal or silica oxides. Metal, as we all know, is very good for making armor, and silica can be surprisingly durable as well (Glass anybody?). It seems dragons have capitalized upon those qualities through evolution, and have developed ways for the materials in the gems to be deposited onto new scales as they grow.
They might also have had a symbiotic relationship with the diamond dogs in the past, with the dragons protecting their miners from threats in return for them digging up the minerals. What might have happened to change that is a mystery.