Heat gas or charcoal grill. Cut 18x18-inch sheet of heavy-duty foil. Cut loaf of bread in half lengthwise. Spread each half with pesto. Sprinkle with cheese.
Place bread, cheese sides together, on foil; wrap securely using double fold seals, allowing room for heat expansion.
When grill is heated, place wrapped bread on gas grill over medium heat or on charcoal grill over medium coals; cover grill. Cook 10 to 12 minutes, rotating and turning over occasionally, until bread is warm and cheese is melted.
Carefully unwrap bread to allow steam to escape. Separate loaf into 2 halves; cut each into 6 pieces. Serve immediately.