How to assign priority groups of tartaric acid?
First you have to rank the molecules around the two chiral centres of tartaric acid according to Cahn Ingold Prelog principle. (I have added the principle in below after this 3 points)
After ranking the molecules according to Cahn Ingold Prelog principle, then orient the molecule such that the lowest priority group is directed away from you. The three remaining groups then project toward you.


If you intend to find the configuration of the molecule (i.e. R or S), then let me add this point:


If the three groups projecting towards you are ordered from highest priority to lowest priority (i.e from rank 1 to rank 3) in clockwise manner, then the configuration is "R". If the three groups projecting towards you are ordered from highest priority to lowest priority (i.e from rank 1 to rank 3) in counterclockwise manner, then the configuration is "S". I mentioned "from rank 1 to rank 3" - because the 4th one is oriented away from us and is not considered while checking the order.


Cahn Ingold Prelog principle:

Rule to prioritize the groups attached to a chiral carbon:


Prioritize the four atoms, or groups of atoms, attached to the chiral center based on the atomic number of the atom that is bonded directly to the chiral center. The higher the atomic number, the higher the priority.


Like say you have carbon and lets the 4 atoms attached to it are: $\ce{H},\ce{OH},\ce{Cl},\ce{Br}$.
So here the carbon is chiral, as all the 4 atoms attached to it are different and now for ranking, we rank it on the basis of atomic number. Here as Br has highest atomic number, It would be ranked 1, then Cl would be ranked 2, then OH will be ranked 3 (oxygen will be considered as it is directly attached to the chiral carbon) and then hydrogen will be ranked last.

Atoms participating in double/triple bonds are considered to be bonded to an equivalent number of similar "phantom" atoms by single bonds. This is done just for the purpose of the rule. See this pic for better understanding: 
If two or more of the atoms that are bonded directly to the chiral center are the same, then prioritize these groups based on the next set of atoms (i.e. atoms adjacent to the directly bonded atoms)


Lets take an example here. Say to the carbon I have $\ce{CH3},\ce{COOH},\ce{Cl},\ce{H}$ attached. 
Here first we will compare the atomic number of the atoms which are directly attached to the chiral carbon i.e. C, Cl and H. From these as Cl has highest atomic number, hence it is ranked 1. Then, for the carbon, as for both the groups i.e $\ce{CH3}$'s and $\ce{COOH}$'s, it is the carbon atom which is directly connected to the chiral carbon. Hence, we need to look for the next set of atoms. $\ce{CH3}$ next set of atoms are H, H &amp; H; while $\ce{COOH}$'s next set of atoms are O, H and O-C (see pic provided in rule 2). So from here easily we can say $\ce{COOH}$ is ranked 2, then $\ce{CH3}$ (i.e. rank 3) and then H.