In caramel, butter serves to enrich the flavor and enhances the overall taste by introducing a rich and buttery note, complementing the sweetness of the caramelized sugar.