It is in many cases of high heraldic importance and often originates in an important event of the past but it can also be a maxim, a rule or a guiding line by which a certain group decides to live.
In that sense a motto is an idicator of believe and personal standards.
A motto describes a clan, a family, it denotes direction, a reason for being, a goal, an achievement. It might be something very personal, it might be common (i.e. the Roman carpe diem is frequently used all over facebook) but in a heraldic sense it singles out people, especially on a graveyard.
Many mottos come in Latin. A coat of arms is not a common thing to have after all. A motto signifies importance, a long line of ancestry and a certain quality, so Latin seem the obvious choice. So does French as it was for a considerable time the language of court and jurisdiction in Scotland, Latin the language of the church.
The MacLeod of MacLeod have two, one in Latin, one in the vernacular, English.
Hold fast and murus aheneus esto, be like a wall of brass.
The MacLeods of Talisker used one as a burial chapel until about 1790. It is Medieval and was rebuilt after the reformation.
A gateway leads directly to the sea so the bodies could be brought in on the water way, the people from the Isle of Soay used it. The MacLeods would have used boats from Talisker as well, rather than carry the coffins over the hills. Access through Glen Eynort must have been rather difficult before cars.
Glen Eynort has been a stage for one of the fights between the MacDonalds and the MacLeods of Skye. In the late 14th century the Lord of the Isles attacked Skye and was driven back to Loch Eynort by the MacLeods. They could not escape over the water because their boats had been moved to dry land. All MacDonalds were killed.
The MacDonald motto being per mare per terras.
They came over the sea and died on land and the MacLeods held on fast to their land on Skye and remained true to their motto.
Sources and further reading