I just had this problem last night and tossed out a double batch of buttercream, it was so bad you could feel the grit between your fingers.

So I made a 2nd smaller batch, not as bad but still not good. I had colored part of the slighty better batch with red and I was not about to toss it out even though I could see the sugar crystal in the colored frosting, if that makes sense, the coloring looked spotted.
So then I was out of everything, shortening, sugar etc. I went to a different grocery store and bought new everything and came home. By the time I got home the red had settled in and the overall gritty was pretty much gone. I have to agree with people on here that it is probably the sugar and I can't even say it's the brand. I've used the same brand before and had no problems but gritty seems like a sugar issue

and the new sugar I bought didn't have the problem.
Letting mine rest really did help so if it's not terrible don't necessarily toss out the whole lot. The first batch had no hope

but I'm glad I didn't toss out the red
