When you learn to read Torah (or, for that matter, Haftarah or Megillat Esther or pretty much any biblical section that's chanted out loud), you'll notice that the text is annotated with symbols: arrowheads, zigzags, apostrophes. These are the Trop, also known as T'amim (טעמים)—the accents that tell the reader how to chant a particular word or phrase. Trop are kind of like musical notes, in that they tell you how a section is supposed to sound: when to go up in pitch; when to add a little flourish; which words to emphasize. But they go well beyond that.
Check out Chapter 5 of Deuteronomy:
The text includes the standard Hebrew vowels (dashes and dots above and below the letters); punctuation (mostly colons, to represent the ends of verses); and lots of trop. If all someone was asked to do is to read from a text like this one, then getting the words, punctuation, and melody right would be pretty straightforward.
But it's not straightforward at all, especially when reading from the Torah. Look at how a Torah scroll of Deuteronomy is written (note that Chapter 5 starts about halfway down the middle column):
With the exception of some gaps within or at the end of lines of text, it's just a long series of words. No vowels. No punctuation. No musical instructions. If the reader merely recites the words in succession, the meaning will be unclear, even to fluent Hebrew speakers. If the reader learns which words to emphasize and applies a consistent set of rules to denote when a verse begins, when there's a pause, and when the verse concludes, it's a lot easier to understand.
And that's what the trop are for. In short, Trop are biblical punctuation!
Over the centuries, local Jewish communities developed their own melodies that apply the trop differently. A set of verses chanted in a North African (Sephardic) tradition will sound totally different than the same set of verses chanted in an Eastern European (Ashkenazic) style. The words don't vary, and the emphasis is on the same phrases, but the melodies are completely unrelated. (And even within a given community, the melody used to chant Torah might differ significantly from the melody used to chant a section of Nevi'im/Prophets or K'tuvim/Writings.) The goal is to get the text right, and learning the trop is the best way to guarantee that the text is right.