To caramelize is to slowly cook a food until it turns sweet, nutty, and brown. You can also caramelize pure sugar, or cook it until it melts, becoming golden-brown, sweet, and thick.
When a cook caramelizes chopped onion, she gently cooks it in butter or oil, usually for a long time at a low temperature, until the sugars in the onion begin to brown and become very sweet. She caramelizes sugar by cooking it until it melts and reaches a certain temperature. The verb caramelize comes from caramel, or "burnt sugar" in French.