She takes a large quantity of an expensive perfume and uses it to anoint his feet. She realizes that a great sacrifice on her part is appropriate because of his greatness. Later, Jesus will command his disciples to wash each other's feet.
Judas pronounces her actions as wasteful, "That money could be spent on the poor." But, he is not thinking of the poor. He's planning to use the money for himself. And Jesus knows this.
His rebuke to Judas should not in any way give us permission to ignore the needs of the poor. Rather, since they are always with us, we should always be thinking of ways to continue to show Christ's love through our own actions.