Project is a temporary endeavor to produce a product, service or result. Example: an operations systems for the freight forwarding division of a company.
Program is a group of projects that together may work towards the same objectives. Example: the previous project, plus a system to manage the rail transportation business unit, a system to digitalize any image into the company repository, and a mobile app for truck drivers. All of them are related between them, are for the same customer.
Portfolio is a group of programs and single projects, not related to each other. All the projects executed by a software factory company for all its customers.
In short: a portfolio can have several programs and projects, a program can have several projects, and a project is just a project.