Prepare the water bath canner, jars, and lids. Keep the jars hot in simmering water until you fill them.
Heat the oven to 400 degrees F and line two rimmed baking sheets with parchment paper.
Cut the eggplants in half lengthwise, place them skin side up on one baking sheet, and prick the skins a few times with a fork.
Halve and seed the bell peppers and place them skin side up on the second sheet. Add the seeded hot pepper to this sheet if you're using it.
Roast until the skins start to char. The peppers take about 20 minutes, and the eggplant can take up to 30.
Move the roasted peppers to a covered bowl while they're hot, and let them steam for 10 minutes. Peel off the skins with a sharp knife and discard them.
Let the eggplant cool until you can handle it, then scoop out the flesh and discard the skins and seeds.
Put the peppers, eggplant, garlic, salt, and hot pepper, if using, in a food processor. Pulse on chop for a chunky spread, or puree on low for a smooth one.
Scrape the spread into a stainless steel or enameled saucepan over medium heat, and stir in all of the vinegar.
Bring the ajvar to a boil, stirring constantly so it doesn't splatter or scorch.
Ladle the hot ajvar into hot jars, leaving 1/2 inch headspace. Remove air bubbles and wipe the rims.
Center the lids and apply the bands fingertip tight.
In a boiling water bath canner, with at least 1 inch of water over the jars, process half pints for 15 minutes, adjusting for altitude (see notes).
Turn off the heat, take the lid off the canner, and let the jars rest for 5 minutes before lifting them out.
Cool the jars undisturbed for 12 to 24 hours, then check the seals, remove the bands, and store the jars in a cool, dark place.