For true devotion must issue from the heart, and consist in the truth and substance alone of what is represented by spiritual things; all the rest is affection and attachment preceding from imperfection; and in order that one may pass to any kind of perfection it is necessary for such desires to be killed.St. John of the Cross
As far as I can tell, there are two distinct meanings to these words, depending on the depth of spiritual work.
The first is the admonishment against attachment to ritual and sacred material objects, over the substance of those things. It is extremely easy to get lost in spiritual materialism as it distracts from the difficult and painful parts of the path. Those who become too focused on the symbols, as ends in and of themselves, end up reducing spirituality (and the quest for real liberation) to religion and indoctrination. Ritual can be helpful, to focus the mind and intention, to set aside dedicated time and space for the work, but perfecting rituals it is not the goal of the work.
The second meaning is significantly deeper. Given St. John’s writings about the second dark night, and the excruciating purgations of the spirit which take place there, these same words take on a deeper meaning. It is an instruction to the monastic-level practitioner, and echos quite a bit of the buddhist teachings on this subject as well.
It has to do with the internal separation from egoic investment in mystical experience – the substance of the experience is representative, a reflection, symbolic. It is not ultimate truth. It is personal truth, intended to further the discovery work.
Getting attached to the content of mystical experience, using the experiences themselves to feed self-worth or status, turning the content into vanity is also a distraction. We must utilize the content, understanding that it is purely personal, and then detach from the content. We must come to understand the mystical experiences as a visit to a house of mirrors – reflecting for us, in grand design, our own hidden selves, so that we might see ourselves more clearly. To mistake the symbol for the substance, to mistake the experience for the truth, is in fact an error.
Killing off the aspects of ego that cling and attach to mystical experience is part of the process of perfection and purification.