Karma is one of the most important concepts in Buddhism. Karma is an imprint in one's Mind. When one performs a good deed out of good intentions, the good intentions come from the Mind. Having done that good deed, the residues of these intentions stay in one's Mind as "imprints", and that is "good karma". The opposite goes for evil deeds (or what the Buddha would call "unwholesome deeds") done out of greed, hatred etc.
A person's karma affects a person in 2 ways. The first is his disposition. If a person is an angry one, performing many deeds with anger, his mind will be imprinted with experiences and intentions of anger. Because of this imprint, in a similar situation, he would be more likely to feel angry. In a sense, the imprint creates and reinforces a sort of mental habit that causes a person's mind to react in a certain pre-disposed way.
The second and more important way karma affects a person is by affecting his experience. Our experiences, our feelings of joy or sufferings, come mainly from our reaction to perceptual inputs. Taking our angry guy as an example, in many situations, he feels offended, angry and that seriously affects his state of mind. He often feels the pain of anger, very little peace. But if that person practices meditation, develops his mind, etc etc, such that he develops peace and love. He may live the same life all over and he may not experience the anger or the pain of anger etc in those same situations. In a sense, his karma is one of the main determinants of his experiences. In this sense too, we may say that our sufferings comes from our karma and our states of mind.
The underlying factor in the formation of Karma is Intentions. What gets imprinted into one's mind is largly decided by one's intentions. If I accidently stepped on a spider, for example, squashing it to death, and let's say I didn't even notice, there was no intention, how can there be an imprint into my mind? But if say I stepped on it out of "fun", the desire to cause harm now gets imprinted. In later life, I may become less sensitive to the value of life, I may be bothered by this experience, I may find myself more likely to be hateful, etc etc. That, friend, would be my karma. In a similar way, let's say I lost $20 while touring the slumps of India. The money is nothing to me, so I won't even notice. But somebody found the money and fed his family for a month, saving a dying child's life. If I wasn't even aware that I lost the money, how can there be good karma for me?
(This concept of Karma was one of the main differences btwn the teachings of Buddhism and Jainism. Mahavira Jain taught that all actions, intentional or not, creates karma. The Buddha, speaking from his insights into the mind, taught that the Intention plays the deciding role. From my experience as a meditator, I verified Buddha's position for myself.)
"It is mental volition that I call karma. Having willed, one acts through body, speech or mind!" -- Buddha (Ang. Nik. III.415).