There's nothing worse than finishing a batch of buttercream only to realize that it has an unpleasant gritty consistency. In my experience, it has everything to do with the brand of confectioner's sugar used. Personally, we've always had great results with Domino's confectioners sugar as well as US Sugar (sold at Costco). I'm sure there are others! Some brands of confectioner's sugar don't work as well with buttercream frosting recipes. If a package doesn't say pure cane sugar, it contains beet sugar which is more likely to give you a grainy outcome. In addition to that, we've noticed that even some brands that say "Pure Cane Sugar" will give a grainy consistency. One example is Dixie Crystals (although it was a go-to of ours years ago.) Something has changed. I've read that sometimes it is the type of anti-caking agent that certain brands use that cause grittiness. Your best bet is to do a little experimenting to find the brand that gives you the best results.