In the example sentence, "Their understanding of the subject is as good as their masters," the actual thing being compared is the understanding of their masters. The sentence therefore requires a possessive form for "masters", e.g., "Their understanding of the subject is as good as their masters'."
Which possessive to use (singular or plural) depends on what the sentence is trying to convey. If all the dogs belong to a single master, you would use the single possessive. If the dogs referenced belong to two or more different masters, you would use the plural.
Also, it should be pointed out that the possessive noun form is only required if the sentence is indicating that the noun possesses something. For instance, the sentence, "These dogs are as lazy as their masters!" is correct without the possessive because the sentence is not referring to anything the masters possess.