A boom vang works along side the mainsheet to set the boom's angle relative to the water. It has the advantage of pivoting at the mast, so unlike the sheet, the boom angle does not change as the mainsheet is let out. This controls the mainsail's twist; the shape of the sails leech.
There are some simple guidelines for its operation,
Off the wind, set the vang so the boom is level with the water. Now easing the sheet will not let the boom rise and spill air, keeping the sail efficient. Now it you ever feel like you might round up, spilling the vang will stop that. When we race downwind, we have a person on the vang at all times. We call it the 'ripcord'!
Up wind in moderate breeze, I recommend most sailors keep it loose, and fully control twist with the mainsheet (plus the traveler). Once the breeze picks up, set it snug to your best upwind sheet angle. That way, an ease of the mainsheet keeps the same twist but lets the sail angle off, easing the pressure in puffs. This is called 'vang sheeting'.
That's the basics. Its use gets more complex, but that requires a matching understanding of sail trim, and the desire to work the controls in close concert. Start there and lets talk later in the season!