IDOCS are intermediate documents (normally in text file format) which are used as between SAP and non-SAP system. In a real work, a company may have different systems. So IDOCS are used as a vehicle encapsulate these data so these systems can exchange information.
Eg: During POS, IDOCS are generated and it includes price, number of items, description and etc. Then its transfer ASYNCHRONOUSLY to SAP system. Think of it like excel exporting a file to *.csv and then Outlook can read the *.csv file.
BDOCS on the other hand, is the CRM version of IDOCS. BAPI is another SAP intermediate documents but its used for SYNCHRONOUS transactions.
In the computer world, we called such activity as ELECTONIC DATA INTERCHANCE (EDI)