The .mdf and .ndf are the data files of the database, where all of the tables, indexes (other than fulltext catalogs), stored procedures, etc. are stored. The .mdf is the primary data file and the .ndf only exists if a new file group is created.
The ldf is the transaction log. The transaction log is where all transactions are wirtten to. Upon a checkpoint the contents of the transaction log, .ldf is written to the appropriate .mdf and/or .ndf.