Peaceful monsters are those that do not attack you. They can be attacked, but only with a penalty to your alignment. An attacked peaceful monster also becomes hostile: "The dwarf gets angry!". This is acceptable for late game characters, but dangerous for low level characters with low alignment. Pets do not become hostile even if accidentally or purposefully attacked by the player.
Pets can and will attack peaceful monsters with no penalty to the player, other than the chance of the pet being killed.
Note that attacking monsters with spells or missiles does not result in a yes/no prompt, as melee does; the missile will strike whatever is in its path. Before casting spells or firing missiles, it is sometimes advisable to check the status of a monster with the / or the ; key. This is only recommended for some monsters; for example, orcs will often be peaceful towards orcish player characters, and so should be checked, while others, such as rothes, are always generated hostile.
Also note that the artifact sword Stormbringer will cause you to attack, without offering a yes/no prompt. You receive the message, "Your bloodthirsty blade attacks!"