Difference required for compound to be a phenol vs benzene compound
In organic nomenclature, when you have a compound with multiple functional groups, you follow the priority rules that have been nicely summed up on Wikipedia:


  When compounds contain more than one functional group, the order of precedence determines which groups are named with prefix or suffix forms. The highest-precedence group takes the suffix, with all others taking the prefix form. However, double and triple bonds only take suffix form (-en and -yn) and are used with other suffixes.


These rules apply to benzene derivatives as well as aliphatic and other cyclic compounds.

Continuing,


  Prefixed substituents are ordered alphabetically (excluding any modifiers such as di-, tri-, etc.), e.g. chlorofluoromethane, not fluorochloromethane. If there are multiple functional groups of the same type, either prefixed or suffixed, the position numbers are ordered numerically (thus ethane-1,2-diol, not ethane-2,1-diol.) The N position indicator for amines and amides comes before "1", e.g. $\ce{CH3CH(CH3)CH2NH(CH3)}$ is N,2-dimethylpropanamine


Here's a shorter (and quite handy) version of the Wikipedia table (shamelessly copied from masterorganicchemistry.com, I've taken a liking to their color-scheme :-))


  




So in the example you've posted:



You give the carbon atom that has $\ce{-COOH}$ attached to it the first locant (because $\ce{-COOH}$ takes precedence over $\ce{-OH}$, according to the priority rules), and you continue numbering clockwise so the the two $\ce{-OH}$ groups take locants 3 and 4 respectively (Lowest set of locants rule).

That's how you end up with 3,4-dihydroxybenzoic acid :-)