How do you distinguish definitions from theorems? I read very often and i highlight definitions in orange and theorems in purple, but sometimes I cant really distinguish a definition from a theorem, for example:
Let $A$ be a finite set and $B$ a nonempty set. $|A|≥|B|$ if and only if there exists a function that maps A onto B.
$|A|$ and $|B|$ represent the cardinality of $A$ and $B$ respectively.
I don't understand if this is a theorem (or a rule in general), or a definition, how do you distinguish definitions from theorems since both usually use the sentence "if and only if"? 
 A: To summarize the discussion in the comments:
It should not usually be ambiguous whether a given statement is a theorem or definition.  If a definition is not explicitly labeled as such, if will usually  be written in a form such as


*

*"We will write $|A| \geq |B|$ if..."

*"We say that  is... if..."

*"We call  a ... if..."


or, if the definition is a word (rather than a notation) then a definition will be indicated by italicizing the new term:


*

*"X is a Banach space if...

*"A is positive definite if ...


Generally speaking, authors use "if" rather than "if and only if" for a definition because the "only if" part is implied.  
If it is not indicated as a definition from the above clues, I would assume it is a theorem (or at any rate, a statement that is not a definition.)  Other clues that a sentence is not a definition is if it starts with then, so, thus.
The example you give

Let  be a finite set and  a nonempty set. $|A| \geq |B|$ if and only if
  there exists a function that maps A onto B.

is not standard mathematical writing because sentences should not begin with a symbol.  This makes it somewhat harder to tell if it is a definition or not because of the lack of any word connecting it to the previous sentence, but in the absence of any of the aforementioned cues for a definition I would assume it is not.
Other clues:


*

*Has the word or notation been used before this?  If there is an index, check it.  (Some books also have an index for notation.)  If it has not been used before, it is likely a definition, although it may be a common term that the reader is expected to know from previous study.

*Is the statement justified in any way by the preceding discussion or previous theorems? If so, it is a theorem.


One last possibility is that it is a definition that has been repeated for convenience.  This will be indicated by words like "recall that":


*

*"Recall that $f$ is continuous at $x$ if for all $\epsilon > 0$ there is..."


A definition is rarely given inside a proof (unless it has been repeated, as above.)
Not all authors obey these rules - especially if the setting is more informal, such as blackboard work or class notes.  In that case if you are unsure you can always ask the instructor.
