In a medium skillet over medium, heat the oil. Add the onion and garlic. Cook and stir until the onion is clear and garlic is golden, about 6 minutes. Stir in balsamic vinegar and sugar. Cook an additional 3 to 5 minutes, stirring occasionally, until mixture is thickened.