As you probably know, vortex generators add kinetic energy (KE) to the airflow passing over a wing; they're basically little airfoils which, for obvious reasons, produce vortices at their tips. Those vortices stir up the airstream and thus increase its KE
. Now, without going into too much detail, air passing along a wing gets to a point where it doesn't continue along the wing surface, and separates - that certainly reduces lift, and can in extreme instances lead to a stall. So all vortex generators do is delay that separation by adding KE
to the airstream, so that it continues along the wing surface for a longer period of time.
Okay, you probably know all that already. But why are those vortex generators on the flaps? After all, most vortex generators are mounted near the leading edge of the wing, at least on the wing itself. Well the bigger the flaps get - the more the wing's chord is increased - the greater the chance of early seperation. Even if the wing is fine by itself, deployed flaps can push it over the line. So, rather than creating turbulent flow earlier than necessary with the vortex generators placed on the wing itself, they're located on/just-in-front-of the flaps (where they're needed most). In addition, having the vortex generators on the flaps means they "retract" and disappear when the flaps do, so they're not around any longer than necessary. In addition to the 767, I know that the 777 for one is like that, as well as many/most other relatively large aircraft.