Hamlet is in a bad mood. Polonius asks him what he's reading and he answers "words, words, words" which is true but not very informative. On the other hand, if you don't have a meaning, if you are unable to communicate or understand, then, that's all they are: "words, words, words" just a bunch of symbols with no meaning.
So why is this quote amazing? Because, everything depends on words, everything depends on it, every relationship, every interaction. Hamlet points out that words that some people speak don't convey truth, which is the "matter" as shown in the rest of the quote. We need "the matter", which signifies the subject or topic, which has meaning to be properly aligned with the words spoken or written. In short, words are everything, but the "matter" or meaning is all important too.