Remove stems and strings from beans. Fold a 36x18-inch piece of heavy foil in half to make an 18-inch square. Place beans, shallot, and garlic in center of foil. Sprinkle lightly with salt and pepper. Drizzle with olive oil. Bring up two opposite edges of foil; seal with a double fold. Fold remaining edges to completely enclose vegetables, leaving space for steam to build.
For a charcoal grill, grill packet on the rack of an uncovered grill directly over medium coals for 25 to 30 minutes or until vegetables are tender, turning packet occasionally. (For a gas grill, preheat grill. Reduce heat to medium. Place packet on grill rack over heat. Cover and grill as directed.)