Transformers work essentially the same way generators do- by using the principal that a moving a wire through a magnetic field will create curent. The more loops you put in the wire, the higher the voltage generated.

Only in a transformer, it's not the wire that moves, but the magnetic field- as current goes through the primary, a magnetic field is constantly built up and reversed in the transformer core, which in turn induced current in the transformer secondary. A buck/boost transformer has a number of taps on it, each of which is wired up to a different position along the coils, so that depending which tap you hook up to, there are more or less coils wrapped around that transformer core.