This component should be used for presenting custom messages in the page using the Salesforce pattern for errors, warnings and other types of messages for a given severity.
apex:pageMessage is used when we want to have an individual messages on the visualforce page and you provide the message to be displayed in the attributes of this tag. This is a kind of static message which you will write in visualforce itself and can put some conditions in the rendered attribute to display the message.