Set the oven to 425 degrees.
Cut off the top third of each tomato and slice off a small piece of their bottoms so they can sit up straight, or the eggs may run out. Scoop out the insides with a spoon, leaving just the walls of the tomato shells (see Tip). Sprinkle well with salt and pepper inside and turn the shells upside down on a rack to drain while you make the garlic butter.
Mash the butter with a fork in a small bowl and work in the garlic bits evenly.
Arrange the drained tomato shells right side up in a shallow baking dish just large enough to hold them all. Drop a table-spoon of garlic butter into each tomato shell, followed by a torn-up basil leaf. Add the ham or bacon if you're using it.
Crack an egg into each tomato, sprinkle with salt and pep-per, and scatter 1 tablespoon of the Parmesan evenly over each tomato. Try to leave a little yolk showing so you can tell how the egg is cooking later.
Slide the baking dish into the oven and bake until the egg whites are set but the yolks are still runny, close to 20 minutes. Garnish with slivers of basil if you like, and serve hot.
