Enable you to write custom provisioning logic in templates that CloudFormation runs anytime you create, update (if you changed the custom resource), or delete stacks. For example: include resources that aren't available as AWS CloudFormation resource types, resources not yet supported by CF, on-premise resource, empty a bucket before being deleted, fetch AMI ID, ...
CF Customer Resources --- Create / Update / Delete ---> AWS Lambda Function --- API Calls ---> Whatever with APIs