The tilde is the sign used in writing to determine or indicate the accentuation of words, since these can be esdrújulas or acute, taking into account that these can be accented both in the first syllable when the word has more than three syllables or in the last one. While the grave ones are those that are stressed in the first syllable when the word only has two or three syllables, which is why it does not have an accent.
The definition of tilde is usually a bit complex because on many occasions it tends to be confused with the concept of accent, it is worth noting that all words have an accent. Taking into account that this is the intonation or strength that is given to a part of the word. Highlighting the syllable when pronounced. But the tilde is not the same, since it represents the graphic form of some of those accents. More not to all.
The purpose of the tilde is to mark in writing where the word is accentuated, in those where pronouncing them requires a little more force. The way it is expressed is with a line that is placed diagonally over the letter to be accentuated (´).
In another language it is represented in a different way, for example, in English it does not have any type of accent, while Spanish does. Other languages such as French, the tilde can be represented graphically just as with Spanish, but there is also the circumflex accent, which is where two tildes meet, and the grave accent, which is the tilde, but to the other side.