A patch change is Ardour's description for a combination of MIDI program change and bank select messages, that (typically) instruct a synthesizer or sampler to select a different sound to use on a particular channel.
Patch changes are shown within MIDI regions as small rectangles or flags, with a vertical line showing where in the region (hence "when") this patch change happens.
Inserting Patch Changes
Ensure that the edit point is located where you want the patch change to be (within an existing MIDI region). Context click, and from the MIDI region's context menu, select MIDI > Insert Patch Change. A dialog will appear allowing you to set the bank and program values.
Modifying Patch Changes
Context-clicking on a patch change will bring up the same dialog that was used to create it, allowing you to modify the program and/or bank numbers.
You can also use the mouse wheel: ⇑/⇓ on the patch change will alter the program number, ⇑/⇓ will modify the bank number.
Moving Patch Changes
Just Left-drag on the patch change to move it around.
Removing Patch Changes
Put the mouse pointer into the rectangular area, and press Del or use the delete mouse button operation. This will remove the patch change (the operation can be undone).
Names for Patch Numbers: MIDNAM files