Light a grill and thread the garlic on a skewer. Grill the garlic, chiles and shallots over moderately high heat, turning often, until charred and tender, 8 to 10 minutes for the garlic and chiles and 20 minutes for the shallots.
Transfer the vegetables to a bowl and let cool. Peel the garlic and shallots and transfer to a mortar or a food processor. Peel, seed and core the chiles (or leave in some seeds for extra heat). Add the chiles to the mortar or processor and pound or pulse to a coarse puree. Stir or pulse in the cilantro, fish sauce, sugar and lime juice and serve.