Preheat grill to high (450°F to 500°F). Place garlic cloves and onion on 2 separate pieces of aluminum foil; fold each to create sealed packets. Place packets directly on grill grate; cook, uncovered, turning occasionally, until garlic and onion have softened, about 15 minutes.
Meanwhile, place pineapple slices and chiles on oiled grates. Grill, uncovered, until pineapple is well marked, flipping once, 3 to 5 minutes per side, and skin on chiles is evenly charred, flipping often, 5 to 6 minutes. Transfer to a cutting board, and let cool 5 minutes.
Chop pineapple into ¼-inch pieces, and transfer to a large bowl. Stir in grilled onion and lime juice. Set aside.
Add salt and grilled garlic to a molcajete (see Note), and grind garlic to a smooth paste. Gradually add chiles and olive oil, grinding until mixture forms a mostly smooth paste.
Add chile paste to bowl with pineapple mixture. Stir in parsley, and season with additional salt to taste.