Place the diced eggplant in a colander, sprinkle with salt, and let it sit for about 30 minutes to draw out excess moisture. Rinse and pat dry with paper towels.
In a large skillet, heat the olive oil over medium heat. Add the eggplant and sauté until golden brown, about 5-7 minutes. Remove the eggplant from the skillet and set aside.
In the same skillet, add the onion and garlic. Sauté until the onion is translucent, about 3-4 minutes.
Add the red and green bell peppers to the skillet and cook for another 5 minutes until they are tender.
Stir in the drained diced tomatoes, olives, capers, red wine vinegar, sugar, and the sautéed eggplant. Season with salt and pepper to taste.
Reduce the heat to low and let the mixture simmer for about 15-20 minutes, stirring occasionally.
Remove from heat and let the caponata cool to room temperature before serving. Garnish with fresh basil if desired.