With these kinds of responses, what they mean depends on how impersonal the response is and how far along you got in the hiring process.
If they didn't even an interview you and it looks like a generic form letter rejection, it's just a pleasantry and doesn't mean anything. Some companies might reach out again if they have a position matching your profile, some might not.
However, the more personalised the response is and the further you got in the hiring process (think multiple interviews), the more genuine this is. At that point, you've already impressed the interviewers with your experience, profile or cultural fit. Just because they had a better candidate or didn't think you a perfect match for the position they were hiring for, doesn't mean that they wouldn't like to hire you in another position if one opens up. They've identified you as a good potential hire so it's in their own interests to talk to you again if a position opens up for someone with your profile. Take this as the compliment that it is and reply that you're always open to talking about positions that match your skills and interests.