The ganache may be grainy because the chocolate has not melted properly. This may happen if the chocolate was not cut into small enough pieces or the cream wasn't warm enough to melt the chocolate.