Phonemes are the meaning bearing units of sound that make up words. They can generally be pronounced in different ways, depending on their position in the sentence, or even a person's idiosyncrasies; these different pronunciations are called allophones of the phoneme. But users of the language still recognise them as that particular phoneme. When the phoneme is changed, however, the word becomes a different word or just nonsense. It's the phonemes that make the word.

Phonemes are constructs of language and need to be learnt. This is the reason you can never even recognise the words when listening to a completely foreign language: even when there's nothing wrong with your ears, you have to get to know the phonemes first.

An accent in a language is largely a matter of different pronunciations for the same phonemes. For instance, the southern part of the Netherlands, where I live, is well known for its 'soft g': the way we pronounce 'g' is very different from the way people in Holland do it, less than 100 miles away. Actually, their pronunciation of 'g' is nearly identical to my 'r'; their 'r' is different again. None of this even occurs to me when I speak Dutch with someone from Holland. But I get confused when the context is missing, for instance, in the first sentence of a conversation. It's also confusing when the actual pronunciation is relevant; for instance, someone claimed that Spanish 'j' is roughly pronounced as Dutch 'g', and it took me some time to realise that this makes actual sense - in Holland.