Heat 2 tablespoons of olive oil in a medium saucepan.
Add the onions, ¼ teaspoon kosher salt, and a pinch of ground black pepper, and cook over medium-low heat, stirring occasionally, until just beginning to brown.
Add ¼ cup water and stir, scraping up browned bits from the bottom of the pan.
Continue to cook, stirring occasionally, until onions are browned and softened. Remove from the heat.
Transfer half the onions to a cutting board and chop them finely.
Transfer the non-chopped onions to a medium bowl.
Spoon the remaining onions into a food processor or blender and puree with barbecue sauce until mostly smooth.
Transfer to a bowl with the remaining chopped onions and stir in mayonnaise.
Pour into a serving dish and serve as a topping for your favorite burger.