If a recipe's flour is measured in volume (as are many dessert recipes), use cups. If a recipe is given in weight (breads, pastries, and macarons come to mind) or has a very specific rise, use grams.