I'm facing a difficulty in understanding what exactly is a dialect. I've read many definitions, but I need an example in order to understand them. Can we say that British English and American English are dialects of the English language? And if they aren't, could you provide an example of two dialects of the English language? I'm not English, so I get confused when I read about all the dialects of English.
There's no precise definition of dialect (or language for that matter). All you need to know is that there are systematic differences in pronunciation, morphology, syntax and lexicon between the English used in the United States and United Kingdom. Further, there are regional and contextual differences within each of these regions. So a New Yorker will speak differently from somebody from Minnesota. But both will speak differently if their job is to be a TV commentator. The same happens within the UK.
The regional differences are often called dialects and the contextual differences are called registers but it's rarely clear what the boundaries are. All you need to know is that there are differences along these two axes and know what they are. The labels don't add anything to that knowledge.
But to answer your last question. We can say that British and American English are two different dialects when it comes to the standard (the sort of language heard by the news readers). But when it comes to the way people speak in the streets, there are no British English and American English but rather many dialects of English spoken within the US and the UK. For instance, some dialects spoken in the US may be closer to some dialects spoken in the UK than the US standard in some aspects of their pronunciation or grammar.