To prevent homemade hot fudge sauce from becoming grainy, make sure to thoroughly whisk the ingredients before heating and stir continuously while heating to ensure the sugar dissolves completely.