Preheat the oven to 375 degrees F. Peel the outermost layers of skin off the heads of garlic. Cut off the top third of each head to open the cloves. Put the heads, cut sides up, in a small baking dish and pour the olive oil over them. Season with salt and pepper. Cover tightly, place in the oven and roast until about 3/4 cooked (about 45 minutes).
Uncover and return to the oven until the cloves begin to pop out of their skins and brown (about 15 minutes). Let cool. When cool enough to handle easily, squeeze the roasted garlic into a small bowl. Press firmly against the skins to extract all the sweet roasted garlic you can. Add the oil from the baking dish, the Parmesan cheese, rosemary and a pinch of gray salt. Mix well until a paste forms. Store tightly covered in the refrigerator for up to 1 week.