Compared to (or compared with) is
a set phrase meaning "in comparison to." Like other modifying
participial phrases, it modifies the subject of the sentence. We use
-ed on "compared" because the phrase is derived
from a passive structure and gives a passive meaning.
Because it is a participial phrase that modifies the subject of a sentence,
it can come at the beginning or end of the sentence:
|| Dallas is a small city compared to New York.
Compared to New York, Dallas is a small city.
In both cases above, the participial phrase modifies the subject ("Dallas")
and gives a passive meaning: "[When (or if) Dallas is] compared
to New York, Dallas is a small city."
Here's another example:
Anna is 50 years old, but she is young [when/if
she is] compared to her 99-year-old grandmother.
In your example, "The whole world is nothing to me compared
to her," compared modifies "the
whole world" (the subject of the sentence) and carries a passive
meaning: "When/If the whole world is compared to
her, the whole world means nothing to me."
As a set phrase, compared to is also interchangeable
with in comparison to in the introduction of statistical
facts: "Five percent of the girls voted yes, compared to (in comparison
to) 50 percent of the boys."