In this life you learn to wear many faces. You learn to change and adapt to different people and situations. You do this for a number of reasons, but it's generally for the purpose of fitting in and being accepted.
We are born with a strong sense of wanting to belong and be accepted - though the question is whether we are born with this or is it something that we develop after birth, something we learn from the people and environment around us? Regardless of this, it is an instinct that is outdated and that has evolved in current times to actually prevent us from really developing and sharing ourselves as independent and strong individuals.
Instead of this skill being used for survival as it may have originally been designed for, we use it to avoid social exclusion because these days our own self image is based on how we perceive other people's apparent judgements of us. Everyone is trying to be and live the way they think they're supposed to be living - according to whatever standards they have chosen to hold on to and regard as being important.
A lot of the time we are the ones choosing to change our behaviour or presence in a situation, but sometimes we change in moments without realising it. This is now moving deeper into your 'programming' to levels of your mind. There could be any number of reasons for you to change and not notice - maybe you've met someone with whom you feel a connection - all sorts of things tend to happen when our hormones and potential relationships are involved. Maybe you have developed a very good friendship with someone and now like all the things they like and share the same opinions with them. If you look a little deeper into these two examples, you'll see that the little ways in which you change are not really coming from your choice or even your 'nature' (for lack of a better word in this moment - by 'nature' I mean for example the things you now like or the opinions you have developed in the new relationship or friendship are not really reflecting what you like and how you feel - it's more that you want to fit in / be close / share things with this person). All of this is happening on a subconscious level, so until you stop and really look at yourself and the situation closely, your experience is one of blissful ignorance.
So when someone tells you that you talk differently with a specific person, or act differently, or say or do things you wouldn't normally do - you should assess yourself to see what is actually going on. Are you allowing yourself to change yourself to protect your relationship with them? Are you changing yourself to avoid some potential conflict? Are you changing yourself to try and project yourself to the other person as being this way or that? There are many more reasons - you will have to be objective and a little brutal with yourself to make sure that you are the one who is actually giving yourself and your life direction - because in the end that's what it comes down to: are you truly being who you are and expressing yourself from a point of directive principle.
I cannot say that you should 'express who you are' - as in this world that is naive. In this world we must direct our words and actions with awareness and consideration of what the potential repercussions of those words and actions may be - not only for ourselves but for everything and everyone around us.