Combine Cheddar and mozzarella cheese in a small bowl; place 4 cups cheese mixture into a 9x13-inch baking dish.
Melt butter in a large skillet over medium heat; cook and stir mushrooms, onions, and red pepper until vegetables are tender, about 5 minutes; drain. Spread vegetables over cheese mixture. Top mushroom mixture with ham; sprinkle with remaining 2 cups cheese mixture.
Beat eggs in a bowl; mix in milk, flour, parsley, basil, salt, and pepper. Slowly pour egg mixture into baking dish.
Bake in preheated oven until a knife inserted near the center comes out clean, 35 to 40 minutes.