Why does chocolate go grainy when I melt it?
When your chocolate goes grainy it's called "seizing". There are two main reasons for it to seize:


Water: water getting into the bowl of the double boiler, either because it wasn't dry in the first place, or because of condensation.
Overheating (burning).


Unfortunately, once chocolate has seized there aren't reliable ways to re-temper that particular batch.  Use it for baking or turn it into chocolate sauce, or something.