1. Preheat oven to 350°F. Coat an 8-inch-square baking dish with cooking spray.
2. Bring water, grits and salt to a boil in a large saucepan, stirring occasionally. Reduce the heat and simmer until the grits are thick, 5 to 30 minutes, depending on the type of grits.
3. Meanwhile, combine oil and garlic in a small skillet and cook over medium heat, stirring often, until the garlic is fragrant but not browned, about 1 minute. Remove from the heat.
4. Stir the oil and garlic into the grits along with the cheeses and cayenne (or hot sauce); transfer to the prepared baking dish.
5. Bake, uncovered, until bubbling and crusty on top, about 45 minutes.