A filter basically cleans the water of debris, removes the toxic buildup of ammonia and nitrates, and aerates the water so your fish can breathe and helps to have a healthy environment.
Filter media is anything placed in a filter that changes the quality of water flowing through it. Specific types can be used to create custom environmental conditions in your aquarium.