Cut six 1/4-inch-thick slices from center of onion and reserve. Divide beef into 6 portions. Form indentation in each portion and spoon rounded teaspoon pesto into each indentation. Form beef portions into six 3/4-inch-thick patties, enclosing pesto completely. Grill patties on an oiled rack set 5 to 6 inches over glowing coals 5 minutes. Turn burgers and grill 3 minutes more. Top burgers with mozzarella and grill 2 minutes more, or until just cooked through. Transfer burgers to a platter and let stand while grilling onion. Brush onion on both sides with oil and grill until softened and browned, about 3 minutes on each side.
Spread pesto on both sides of buns and make sandwiches with onion and burgers.
To make the pesto: In a food processor blend together all ingredients with salt and pepper to taste until smooth. Pesto keeps, surface covered with plastic wrap, chilled, 1 week. Makes about 1 cup.