What is the assembly language command STOP and how/when should it be used ?

This stops the CPU & turns off the display until a button is pressed.

In addition, STOP can be used to toggle CPU speed on the GBC.

If a game is idle for 5 minutes or longer you should possibly consider using STOP to stop the CPU & turn off the display to conserve power. Everything is restored after a STOP just by pressing a button. If you use STOP for conversing power you should also consider disabling sound (reset bit 7 of NR52) as the sound circuits seem to draw the most amount of power.

The value in register P1 ($ff00) determines which buttons will terminate the STOP condition. These values are as follows and apply to both the GB & GBC:

$00 - Any button will terminate STOP.
$10 - Only A, B, Select, or Start will terminate STOP.
$20 - Only the direction buttons will terminate STOP.
$30 - No button will terminate STOP.