If your sauce is grainy, it's mostly likely due to it being overheated. It's important to cook it on the proper heat setting and stir often to keep it from getting too hot. When milk overheats/boils, the milk solids separate from the water, causing it curdle. These separated milk solids are what give it that grainy texture, so be sure to stir often and keep an eye on it so it doesn't boil.